
define(['vue','config','common'],
	function(Vue,config,utils){
	'use strict';

	var QR_codeView = new Vue({
		el:'#app',
		data:{
			text : '',
			QCUrl:'',
		},
		created:function(){
			utils.userToken();

			var _this=this;
			var url = utils.getWebUrl('user/getQrcode');
			var pageUrl;

            switch (__ENV__.toLowerCase()) {
	            case "dev" :
	                pageUrl = 'http://192.168.1.118:8080/home/register.html';
	                break;
	            case "prod":
	                pageUrl = 'http://www.exgj.com.cn/register.html';
	                break;
	            case "test":
	                pageUrl = 'http://120.25.77.33:8099/register.html';
	                break;
	        }
	        utils.ajax(utils.getWebUrl('user/personal'),null,'POST',function(res){
				var userTypeId =res.data.userTypeId;

				var data = {
					pageUrl: pageUrl
				};
				utils.ajax(url,data,'POST',function(res){
					_this.text = res.url;			
					_this.QCUrl = config.api.root+'user/getImg.png?url='+escape(_this.text);
				})
			},function(){
				$('.DataLoading').show();
			},function(){
				$('.DataLoading').hide();
			})
		},
		methods:{
			CopyUrl: function(event){
				utils.copyToClipboard(event.currentTarget)
			}
		}
	});

	return QR_codeView;
});